#include <cstdio>

const int N = 105;
int n, m, t, q, dx[26], dy[26];
bool vis[N][N], snk[N][N];

struct Node {
  int x, y;
  Node *lst, *nxt;
  Node(int x, int y) : x(x), y(y) {}
} * head, *tail;

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#else
  freopen("snake.in", "r", stdin);
  freopen("snake.out", "w", stdout);
#endif
#endif

  scanf("%d%d%d%d", &n, &m, &t, &q);
  int x, y;
  for (int i = 1; i <= t; ++i) {
    scanf("%d%d", &x, &y);
    vis[x][y] = true;
  }

  scanf("%d%d", &x, &y);
  head = new Node(x, y);
  tail = head;
  head->lst = tail;
  tail->nxt = head;
  vis[x][y] = true;

  dx['L' - 'A'] = 0, dx['U' - 'A'] = -1, dx['D' - 'A'] = 1, dx['R' - 'A'] = 0;
  dy['L' - 'A'] = -1, dy['U' - 'A'] = 0, dy['D' - 'A'] = 0, dy['R' - 'A'] = 1;

  for (int i = 1; i <= n; ++i) vis[i][0] = vis[i][m + 1] = true;
  for (int i = 1; i <= m; ++i) vis[0][i] = vis[n + 1][i] = true;
  char dir[2];
  for (int i = 1, opt; i <= q; ++i) {
    scanf("%d", &opt);
    if (opt == 1) {
      scanf("%s", dir);

      int tx = head->x + dx[dir[0] - 'A'];
      int ty = head->y + dy[dir[0] - 'A'];
      if (vis[tx][ty]) return printf("%d", i), 0;
      vis[tx][ty] = true;
      head->nxt = new Node(tx, ty);
      head->nxt->lst = head;
      head = head->nxt;

    } else {
      vis[tail->x][tail->y] = false;
      tail = tail->nxt;
      delete tail->lst;
    }
  }
  puts("-1");
  return 0;
}
